<%@ page language="java" contentType="text/html; charset=utf-8"%>
<%@ include file="/taglibs.jsp"%>
<html>
<head>
<title>物流交易市场后台管理</title>
<link rel="stylesheet" type="text/css" href="/js/themes/default/easyui.css">
<link rel="stylesheet" type="text/css" href="/js/themes/icon.css">
<script type="text/javascript" src="/js/jquery-1.4.4.min.js"></script>
<script type="text/javascript" src="/js/jquery.easyui.min.js"></script>
<script type="text/javascript" src="/js/easyui_validatebox.js"></script>
<script type="text/javascript" src="/js/locale/easyui-lang-zh_CN.js"></script>
<style type="text/css">
td {
	font-size: 13px
}
table.ttb{border-left:solid 1px #99bbe8;border-top: solid 1px #99bbe8;}
table.ttb td{word-break: break-all; word-wrap:break-word;vertical-align: top; padding-left:8px; border-right: solid 1px #99bbe8;border-bottom: solid 1px #99bbe8; line-height: 24px; font-size: 12px;}
.bg001{font-weight: bold; color: #333; background-color: #edf4fc}
</style>
	<script>
		$(function(){
			$('#tab').datagrid({
				title:'用户信息',
				iconCls:'icon-save',
				nowrap: false,
				striped: true,
				pageSize:20,
				sortName:"id",
				sortOrder:"desc",
				pageList:[10,20,30,40,50],
				url:'/itmanager/yh/json',
				remoteSort: false,
				idField:'id',
				frozenColumns:[[
	                	{field:'ck',checkbox:true}
	                ]],
				columns:[
					[
					 
						/* sfdsf,sfdxs,mddsf,mddxs,cllx,dw,cc,lxr,lxdh,fbrq,yxq,cph */
						{title:'车辆信息',width:250,colspan:4,align:center},
						{title:'路线信息',width:400,colspan:4},
						/* {field:'xxdz',title:'详细地址',width:200,rowspan:2,sortable:true,
							sorter:function(a,b){
								return (a>b?1:-1);
							}
						}, */
						{title:'联系人',field:"lxr",width:60,rowspan:2},
						{title:'联系电话',field:"lxdh",width:75,rowspan:2},
						{title:'发布时间',field:"fbrq",width:80,rowspan:2,sortable:true},
						{title:'有效期',field:"yxq",width:60,rowspan:2,sortable:true},
						{title:"审核状态",field:"zt",width:60,rowspan:2,sortable:true,formatter:
					    	 function(value,rowData,rowIndex){
						    	 if(value == "01"){
						    		 return "通过";
						    	 }
						    	 else if(value == "02"){
						    		 return "<font color='red'>不通过</font>";
						    	 }
						    	 else if(value == "0"){
						    		 return "<font color='blue'>待审核</font>";
						    	 }
					     	}
					     }
					],[
						{field:'cph',title:'车牌号',width:60},
						{field:'cllx',title:'车辆类型',width:60},
						{field:'cc',title:'车长-米',width:50,sortable:true},
						{field:'dw',title:'吨位-吨',width:50,sortable:true},
					   
						{field:'sfdsf',title:'始发地省份',width:85},
						{field:'sfdxs',title:'始发地市县',width:85},
						{field:'mddsf',title:'目的地省份',width:85},
						{field:'mddxs',title:'目的地市县',width:85}
					]
				],
				fit:true,
				border:false,
				pagination:true,
				rownumbers:true,
				toolbar:[{
					text:'通过',
					iconCls:'icon-ok',
					handler:function(){
						sh('01');
						
					}
				},{
					text:'不通过',
					iconCls:'icon-no',
					handler:function(){
						sh('02');
					}
				},'-',{
					text:'查看详情',
					iconCls:'icon-search',
					handler:function(){
						show();
					}
				}]
			});
			
			 $("#tab").datagrid("getPager").pagination({
				   onSelectPage:function(){
					  $("#tab").datagrid("clearSelections");
					  var queryParams = $.extend({},$("#tab").datagrid("options").queryParams,
							  {shqk:$("#shqk").val()}); 
					  $("#tab").datagrid("reload",queryParams);
				   }
			  });
			 
				car = $('#car-window').window({
					modal: true,
					maximizable:false,
					minimizable:false,
					collapsible:false,
					closed:true
				
				});
			 
		});
		
		var find = function(){
			$("#tab").datagrid("clearSelections");
			var queryParams = $.extend({},$("#tab").datagrid("options").queryParams,{shqk:$("#shqk").val()}); 
			$("#tab").datagrid("getPager").pagination({pageNumber:1});
			$("#tab").datagrid("reload",queryParams);
		}
		
		var show=function(){
			var rows = $("#tab").datagrid("getSelections");
			var length = rows.length;
			if(length != 1){
				$.messager.alert("友情提示","<br/><b>只能选择一条记录！</b>","error");
				return false;
			}
			var id=rows[0].id;
			$.ajax({
		 		type:"get",
		 		url:"/manager/car/show",
		 		data:"id="+id,
		 		success:function(data){
		 		 	car.window("open");
		 		 	data=$.parseJSON(data);
					var sign="=>>";
					mtext("#car-cph",data.cph);
					mtext("#car-cllx",data.cllx);
					mtext("#car-cc",data.cc+'米');
					mtext("#car-dw",data.dw+'吨');
					mtext("#car-lxr",data.lxr);
					mtext("#car-lxdh",data.lxdh);
					mtext("#car-fbrq",data.fbrq);
					mtext("#car-yxq",data.yxq);
					if(data.lgdd==''||data.lgdd==undefined||data.lgdd==null){
		 		 		data.lgdd="...";
		 		 	}
					mtext("#car-lxxx",data.sfdsf+data.sfdxs+sign+data.lgdd+sign+data.mddsf+data.mddxs);
					mtext("#car-bj",data.bj);
					mtext("#car-bz",data.bz);
					if(data.zt=='0'){
						mtext("#car-zt","待审核");
		 		 	}else if(data.zt=='01'){
		 		 		mtext("#car-zt","通过");
		 		 	}else if(data.zt=='02'){
		 		 		mtext("#car-zt","不通过");
		 		 	}
		 		}
		 	});
		}
		
		function mtext(target,text){
			$(target).html("&nbsp;");
			$(target).html(text);
		}
		
		var sh = function(param){
			var rows = $("#tab").datagrid("getSelections");
			var length = rows.length;
			if(length == 0){
				$.messager.alert("友情提示","<br/><b>请先选择记录！</b>","error");
				return false;
			}
			var ids = [];
			for(var i=0;i<length;i++){
				ids.push(rows[i].id);
			}
			ids.join(",");
		 	$.ajax({
		 		type:"post",
		 		url:"/manager/car/sh",
		 		data:"shqk="+param+"&ids="+ids,
		 		success:function(data){
		 		 	var queryParams = $.extend({},$("#tab").datagrid("options").queryParams);
		 			$("#tab").datagrid("reload",queryParams);
		 			$("#tab").datagrid("clearSelections");
		 		}
		 	});
		}
		
	</script>
</head>
<body class="easyui-layout">
	<div region="north" border="false" style="height:80px;" iconCls="icon-search" title="查询条件">
		<table width="100%" height="100%" style="background-color:#E0ECFF ">
			<thead>
				<tr>
					<td width="10%" align="center">审核情况</td>
					<td width="30%"><select id="shqk" name="shqk" style="width: 200px">
						<option value="">--全部--</option>
						<option value="0">待审核</option>
						<option value="01">通&nbsp;&nbsp;过</option>
						<option value="02">不通过</option>
					</select></td>
					<td><a class="easyui-linkbutton" iconCls="icon-search" onclick="find()">查询</a></td>
				</tr>
			</thead>
		</table>
	</div>
	<div id="center" region="center">
		<table id="tab"></table>
	</div>
	
	<div id="car-window" title="查看车辆详情" style="width:500px;">
				
		<table class="ttb" border="0" cellspacing="0" cellpadding="0" width="100%">
							
							
		</table>
					
	</div>

</body>
</html>